package com.dhc.appbusinessfrm.business.common;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.dhc.appbusinessfrm.business.base.BaseBusiness;
import com.dhc.appbusinessfrm.business.base.BaseBusinessImpl;

import javax.inject.Inject;

/**
 * Created by xy on 2015/6/11.
 */
public class NetworkBusinessImpl extends BaseBusinessImpl implements NetworkBusiness{



    @Override
    public boolean isNetworkConnected(Context context) {
        ConnectivityManager cm = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);

        NetworkInfo info = cm.getActiveNetworkInfo();
        // if (info == null || !cm.getBackgroundDataSetting()) {
        if (info == null) {
            return false;
        }
        if (info.isConnected()) {
            return true;
        } else {
            return false;
        }
    }
}
